package com.example.mq.mqserver.mapper;

import com.example.mq.mqserver.core.Binding;
import com.example.mq.mqserver.core.Exchange;
import com.example.mq.mqserver.core.MSGQueue;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: ws
 * Date: 2023-09-30
 * Time: 22:23
 */
@Mapper
public interface MetaMapper {
    // 提供三个核心的建表方法
    void createExchangeTable();
    void createQueueTable();
    void createBindingTable();

    // 针对上述的三个基本概念，进行插入和删除
    void insertExchange(Exchange exchange);
    void deleteExchange(String exchangeName);
    void insertQueue(MSGQueue queue);
    void deleteQueue(String queueName);
    // 下面两个需要知道 exchangeName 和 queueName，所以直接传入 Binding对象
    void insertBinding(Binding binding);
    void deleteBinding(Binding binding);
    // 查找
    List<Exchange> selectAllExchanges();
    List<MSGQueue> selectAllQueues();
    List<Binding> selectAllBindings();
}
